/***********************************************************
! @File        : mainmanager.h
 *  @Brief       : 提供给qml的接口
 *  @Details     : 截图功能，发送邮件功能
 *  @Author      : soda
 *  @Date        : 2023-11-06 10:36:36
 *  @Version     : v1.0
 *  @Copyright   : Copyright By soda, All Rights Reserved
 ***********************************************************/

#pragma once
#include <QObject>
#include <QQmlEngine>
#include <QApplication>
#include <classes.h>
#include <QTimer>


/// 定义一个crashreport的传参结构体
#define ARGUMENTS_SIZE      5
typedef struct CrashArguments {
    quint64 useid;
    QString appVersion;
    QString regionUrl;
    QString gaUrl;
    QString cloudUrl;

    CrashArguments(){
        useid = 0;
        appVersion = "0.0.0.0";
        regionUrl = "";
        gaUrl = "";
        cloudUrl = "";
    }
}CrashArguments;

class HttpRequest;
class MainManager : public QObject
{
    Q_OBJECT
public:
    explicit MainManager(QObject *parent = nullptr);
    ~MainManager();

    static void declareQML();

    // 主界面的相关信息
    Q_INVOKABLE QString getApplicationDirPath();
    Q_INVOKABLE QString getTitleName();
    Q_INVOKABLE void quitApp();
    Q_INVOKABLE void getStockInfo(QString code);



signals:
    void signalStockInfomation(const QString& name, const QString& price);
    void signalHold(const float unitPrice, const int number, const float money);
    void signalCurrentCode(const int code);

private:
    HttpRequest* m_httpPost = nullptr;
    QTimer m_timer;
};


